package com.qdlc.p2p.biz.tpp.model;

import java.io.IOException;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.qdlc.p2p.common.constant.SinaConstant;
import com.qdlc.p2p.common.util.DateUtil;
import com.qdlc.p2p.common.util.StringUtil;

/**
 * 新浪支付-查询收支明细
 * 
 * @author ygw
 * @version 2.0
 * @date 2015年12月11日 下午2:47:02
 */
public class SinaQueryAccountDetails extends SinaModel {
	
	/**
	 * 服务名称
	 */
	private String service;
	
	/**
	 * 账户类型：基本户（BASIC） 保证金户（ENSURE） 
	 * 		 准备金（RESERVE） 存钱罐（SAVING_POT）
	 * 默认基本户
	 */
	private String account_type;
	
	/**
	 * 开始时间
	 */
	private String start_time;
	
	/**
	 * 结束时间
	 */
	private String end_time;
	
	/**
	 * 扩展信息
	 */
	private String extend_param;

    /**
     * 待签名字符数组
     */
    private String[] signParamNames = new String[]{"version", "service", "request_time", "partner_id", "_input_charset", "identity_id", "identity_type", "account_type",
            "start_time", "end_time", "extend_param"};

    /**
     * 提交字符数组
     */
    private String[] subParamNames = new String[]{"version", "service", "request_time", "partner_id", "_input_charset", "sign", "sign_type", "identity_id", "identity_type", "account_type",
            "start_time", "end_time", "extend_param"};

    /******** 响应信息 start ********/
	
	/**
	 * 页号
	 */
	private String page_no;
	
	/**
	 * 收支明细列表
	 */
	private String detail_list;
	
	/**
	 * 每页大小
	 */
	private String page_size;
	
	/**
	 * 总计录数
	 */
	private String total_item;
	
	/**
	 * 总收入
	 */
	private String total_income;
	
	/**
	 * 总支出
	 */
	private String total_payout;
	
	/******** 响应信息 end ********/
	
	/**
	 * 获取服务名称
	 */
	public String getService() {
		return service;
	}

	public SinaQueryAccountDetails() {
		super();
	}
	
	public SinaQueryAccountDetails(String account_type,String identity_id,String start_time, String end_time,String extend_param) {
		super();
		this.account_type = account_type;
		this.start_time = start_time;
		this.end_time = end_time;
		this.extend_param = extend_param;
        if(StringUtil.isEmpty(extend_param))
        {
            signParamNames = new String[]{"version", "service", "request_time", "partner_id", "_input_charset", "identity_id", "identity_type", "account_type",
                    "start_time", "end_time"};
            subParamNames = new String[]{"version", "service", "request_time", "partner_id", "_input_charset", "sign", "sign_type", "identity_id", "identity_type", "account_type",
                    "start_time", "end_time"};
        }

		this.setIdentity_type(SinaConstant.IDENTITY_TYPE_UID);
		this.setIdentity_id(identity_id);
		this.setEncode(SinaConstant.ENCODE_TRUE);
		this.service = "query_account_details";
		this.setRequest_time(DateUtil.dateStr3(DateUtil.getNow()));



	}
	
	public SinaQueryAccountDetails(String account_type,String identity_id,String start_time, String end_time,String page_no,String page_size,String extend_param) {
		super();
		this.account_type = account_type;
		this.start_time = start_time;
		this.end_time = end_time;
		this.page_no = page_no;
		this.page_size = page_size;
		this.extend_param = extend_param;
        if(StringUtil.isEmpty(extend_param))
        {
            signParamNames = new String[]{"version", "service", "request_time", "partner_id", "_input_charset", "identity_id", "identity_type", "account_type",
                    "start_time", "end_time","page_no","page_size"};
            subParamNames = new String[]{"version", "service", "request_time", "partner_id", "_input_charset", "sign", "sign_type", "identity_id", "identity_type", "account_type",
                    "start_time", "end_time","page_no","page_size"};
        }

		this.setIdentity_type(SinaConstant.IDENTITY_TYPE_UID);
		this.setIdentity_id(identity_id);
		this.setEncode(SinaConstant.ENCODE_TRUE);
		this.service = "query_account_details";
		this.setRequest_time(DateUtil.dateStr3(DateUtil.getNow()));



	}

	@Override
	public SinaModel response(String res) throws IOException {
		try {
			JSONObject json = JSON.parseObject(res);
			detail_list = json.getString("detail_list");
			total_income = json.getString("total_income");
			total_payout = json.getString("total_payout");
			total_item = json.getString("total_item");
		} catch (Exception e) {
			e.printStackTrace();
		}

		return null;

	}
	
	/**
	 * 设置服务名称
	 */
	public void setService(String service) {
		this.service = service;
	}

	/**
	 * 获取待签名字符数组
	 */
	public String[] getSignParamNames() {
		return signParamNames;
	}

	/**
	 * 设置待签名字符数组
	 */
	public void setSignParamNames(String[] signParamNames) {
		this.signParamNames = signParamNames;
	}

	/**
	 * 获取提交字符数组
	 */
	public String[] getSubParamNames() {
		return subParamNames;
	}

	/**
	 * 设置提交字符数组
	 */
	public void setSubParamNames(String[] subParamNames) {
		this.subParamNames = subParamNames;
	}

	public String getEnd_time() {
		return end_time;
	}

	public void setEnd_time(String end_time) {
		this.end_time = end_time;
	}

	public String getExtend_param() {
		return extend_param;
	}

	public void setExtend_param(String extend_param) {
		this.extend_param = extend_param;
	}

	public String getPage_no() {
		return page_no;
	}

	public void setPage_no(String page_no) {
		this.page_no = page_no;
	}

	public String getDetail_list() {
		return detail_list;
	}

	public void setDetail_list(String detail_list) {
		this.detail_list = detail_list;
	}

	public String getPage_size() {
		return page_size;
	}

	public void setPage_size(String page_size) {
		this.page_size = page_size;
	}

	public String getTotal_item() {
		return total_item;
	}

	public void setTotal_item(String total_item) {
		this.total_item = total_item;
	}

	public String getTotal_income() {
		return total_income;
	}

	public void setTotal_income(String total_income) {
		this.total_income = total_income;
	}

	public String getTotal_payout() {
		return total_payout;
	}

	public void setTotal_payout(String total_payout) {
		this.total_payout = total_payout;
	}

	public String getAccount_type() {
		return account_type;
	}

	public void setAccount_type(String account_type) {
		this.account_type = account_type;
	}

	public String getStart_time() {
		return start_time;
	}

	public void setStart_time(String start_time) {
		this.start_time = start_time;
	}

}
